package com.zl.learning.quartz;

import org.quartz.*;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by zhaolei on 2017/6/19.
 */
public class HelloJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        Date date = new Date();
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("current Exce Time is:"+sf.format(date));
        System.out.println("HelloWorld!");
        JobKey key = context.getJobDetail().getKey();
        System.out.println(key.getName()+":"+key.getGroup());
        TriggerKey trKey = context.getTrigger().getKey();
        System.out.println(trKey.getName()+":"+trKey.getGroup());
        JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        System.out.println(jobDataMap.getString("name"));
        JobDataMap jobDataMap1 = context.getTrigger().getJobDataMap();
        System.out.println(jobDataMap1.getString("name"));
    }
}
